<template>
  <div>
    <div class="config">
             <div class="back" onclick="window.history.go(-1)"><img src="../assets/images/back.png" alt=""></div>

      <p>申请提现</p>
    </div>

    <div class="price">
        <p>提现金额</p>
        <input type="number" placeholder="提现最小额度¥0.01" v-model="price">
    </div>

    <div class="btn">
      <button @click="applyCash()">确认申请</button>
    </div>


    
  

  </div>
</template>

<script>
export default {
    name: "applyCash",
    data() {
        return {
            price: ""
        };
    },
    beforeCreate() {
        document.getElementsByTagName("body")[0].style.background = "#fff";
    },
    methods: {
        applyCash() {
            if (this.price == "") {
                this.$Message.warning("提现金额不能为空");
            } else {
                var qs = require("qs");
                this.axios({
                    method: "post",
                    url: `${this.siteUrl}/setCashed`,
                    data: qs.stringify({
                        uid: localStorage.getItem("uid"),
                        price: this.price
                    })
                })
                    .then(response => {
                        
                        if (response.data.result == 200) {
                            this.$Message.success("正在申请提现");
                            this.price=""
                        } else {
                            this.$Message.error(response.data.message);
                        }
                    })
                    .catch(function(error) {
                        console.log(error);
                    });
            }
        }
    },
    mounted() {}
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.price {
    height: 40px;
    padding: 10px;
    font-size: 14px;
    margin-top: 10px;
}
.price p {
    float: left;
    width: 100px;
}
.price input {
    float: right;
    text-align: right;
    border: none;
}
input::-webkit-input-placeholder {
    color: #ddd;
}

.btn {
    position: absolute;
    top: 140px;
    margin-left: 10%;
}

.btn button {
    width: 80vw;
    height: 40px;
    background: #5aa0c8;
    border: none;
    color: #fff;
    outline: none;
}
</style>
